<?
session_start();
include('conn.php');

$custid = $_SESSION['custid'];
$custtype = $_SESSION['custtype'];
if(!$_SESSION['custid'])
	$custid = 0;
if(!$_SESSION['custtype'])
	$custtype = "0";
 
$qry1 = "SELECT custid, custdesc, custtype as custtype, status,outstdamt
FROM oustandingsnapshot
where snapshotdate = (select max(snapshotdate) from oustandingsnapshot)";

$qry = mysql_query($qry1);
$data = array();
$i=1;
while($rows = mysql_fetch_array($qry))
{
	$data[] = array("Sr_NO" => $i++,
					"custid" => $rows['custid'],
					"custdesc" => $rows['custdesc'],
                    "outstdamt" => $rows['outstdamt'],	
                    "custtype" => $rows['custtype'],
                    "report" =>	sprintf("outprint_report.php?custid=%d&custdesc=%s", $rows['custid'],$rows['custdesc']) 
                    );
}
echo json_encode($data);
?>